<%-- 
    Document   : changePassword
    Created on : 21/09/2011, 9:35:15 AM
    Author     : David Bullock 42062222
--%>
<style>
    #changeform {         
        padding-bottom:20px;
        padding-top:20px;
        padding-left:70px;
        font-family: Verdana,Arial;
    }   
    #button{
       padding-left: 373px;        
    }
    #info{
        padding-left: 30px;
        padding-top: 20px;
        padding-bottom: 20px;
        font-size:10px;
        text-align: left;
        font-family:Verdana,Arial;
    }
</style>    
<%@ include file="header.jsp" %>

<style>
    .error { color: red; }
</style>  

<div id="content-container">
    <div id="content">
        
            <%if (request.getParameter("success") != null && request.getParameter("success").equals("true")) {%>
            <p id="info">Your password was changed successfully. <br/>
                You should be automatically redirected to the home page in 5 seconds 
                    or <a href ="<%="/DbPoll/" + userType.toLowerCase() + "/home.html"%>">click here</a></p>
            <script type="text/javascript">
                setTimeout("redirect()",5000);
                function redirect(){
                    window.location = "/DbPoll/<%=userType.toLowerCase()%>/home.html";
                }
            </script>
            <%} else {%>
            <%String username = (String) session.getAttribute("username");%>
            <%String userID = (String) session.getAttribute("userID");%>
            <form:form  method="post" commandName="changePassword" >
                <span hidden="true"><form:input path="userName" title="userName" value="<%=username%>"/></span>                
                <span hidden="true"><form:input path="userID" title="userID" value="<%=userID%>"/></span>                
                <form:errors path="userName" cssClass="error"/></br>    
                <table id="changeform" width="60%" border="0" cellspacing="0" >
                    <tr>
                        <td width="30%">Current Password:</td>
                        <td width="20%">
                            <form:input path="current" title="current password"/>
                        </td>
                        <td >
                            <form:errors path="current" cssClass="error"/>
                        </td>
                    </tr>
                    <tr>
                        <td width="40%">New Password:</td>
                        <td width="20%"> 
                            <form:password path="pass1" title="new password"/>
                        </td>
                        <td>
                            <form:errors path="pass1" cssClass="error"/>
                        </td>
                    </tr>
                    <tr>
                        <td width="40%">Retype Password:</td>
                        <td width="20%">
                            <form:password path="pass2" title="new password"/>
                        </td>
                        <td>
                            <form:errors path="pass2" cssClass="error"/>
                        </td>
                    </tr>                
                </table>
                <div id="button">
                    <input type="submit" align="right" value="Change">
                </div>
            </form:form>
            <%}%>
        


    </div>
</div>		

<%@ include file="footer.jsp" %>
